<!--
  车位表编辑页面
  User: YanZengBao
  Date: 2020-02-19
-->
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<!-- BEGIN FORM-->
<div class="portlet light">
    <div class="portlet-title">
        <div class="caption">
            <span class="caption-subject font-red-sunglo bold uppercase">车位表编辑</span>
            <span class="caption-helper">编辑一条车位表数据</span>
        </div>
    </div>
    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form action="#" class="form-horizontal" id="edit-module">
            <div class="form-body">

                <!--  字段信息-->
                <div class="form-group hide">
                    <label class="col-md-3 control-label"></label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" disabled class="form-control" required name="id"
                                       th:value="${data['id']}" placeholder="">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 停车场ID 字段信息-->
                <div class="form-group hide">
                    <label class="col-md-3 control-label">停车场ID</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" required  name="parkId"
                                       th:value="${data['parkId']}" placeholder="停车场ID">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 停车场名称 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">停车场名称</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" readonly class="form-control" required  name="parkName"
                                       th:value="${data['parkName']}" placeholder="停车场名称">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 车位编号 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">车位编号</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" maxlength="32" required
                                       name="parkinglotCode" th:value="${data['parkinglotCode']}" placeholder="车位编号">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 车位状态：1:使用中；0:未使用 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">车位状态</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>

                                <select class="form-control" required name="parkinglotStatus">
                                    <option value="1" th:selected="${data['parkinglotStatus'] == 1}">使用中</option>
                                    <option value="0" th:selected="${data['parkinglotStatus'] == 0}">未使用</option>
                                </select>

                                <!-- <input type="number" class="form-control" required  name="parkinglotStatus" th:value="${data['parkinglotStatus']}" placeholder="车位状态：1:使用中；0:未使用">-->
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 车位类型（1，有地锁车位  2,有地磁 3.无地锁车位） 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">车位类型</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <select class="form-control" required name="parkinglotType">
                                    <option value="3" th:selected="${data['parkinglotType'] == 3}">普通车位</option>
                                    <option value="1" th:selected="${data['parkinglotType'] == 1}">地锁车位</option>
                                    <option value="2" th:selected="${data['parkinglotType'] == 2}">地磁车位</option>
                                </select>
                                <!--<input type="number" class="form-control" required  name="parkinglotType" th:value="${data['parkinglotType']}" placeholder="车位类型（1，有地锁车位  2,有地磁 3.无地锁车位）">-->
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 是否已绑定分区（0-未绑定 1-已绑定） 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">是否已绑定分区</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <select class="form-control" disabled required name="status">
                                    <option value="0" th:selected="${data['status'] == 0}">未绑定</option>
                                    <option value="1" th:selected="${data['status'] == 1}">已绑定</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-md-3 control-label">区域名称</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" readonly th:value="${data['areaName']}">
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 备注 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">备注</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <textarea type="text" class="form-control" maxlength="255"  name="intro"
                                          th:text="${data['intro']}" placeholder="备注"/>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 地锁的唯一标识(控制地锁) 字段信息-->
                <div class="form-group">
                    <label class="col-md-3 control-label">地锁标识</label>
                    <div class="col-md-4">
                        <div class="input-inline ">
                            <div class="input-group">
                                        <span class="input-group-addon">
                                            <i class="fa fa-edit"></i>
                                        </span>
                                <input type="text" class="form-control" name="lockNumber"
                                       th:value="${data['lockNumber']}" placeholder="地锁的唯一标识(非必填)">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-6">
                        <div class="row">
                            <div class="col-md-offset-3 col-md-9">
                                <button type="button" class="btn green" onclick="edit();">保存</button>
                                <button type="button" class="btn default" onclick="layer.close(layer_editModule);">取消
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6"></div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>

<script>

    $(function () {
        //初始化页面
        initPage();
    });

    function edit() {
        let param = tools.formParams("edit-module");
        if (tools.valid("edit-module")) {
            tools.post("/parkinglot/update", param, function (data) {
                if (data.success) {
                    layer.msg(data.message, {icon: 1, time: 1000}, function () {
                        //刷新列表页面
                        toPage(null);
                        //关闭弹窗
                        layer.close(layer_editModule);
                    });
                } else {
                    tools.errorTip(data);
                }
            });
        }
    }

</script>
</html>